package com.aaa.controller.mht;


import com.aaa.entity.LayData;
import com.aaa.entity.MyPage;
import com.aaa.entity.mht.TMhtMessage;
import com.aaa.entity.mht.TMhtRecord;
import com.aaa.service.mht.TMhtRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (TMhtRecord)表控制层
 *
 * @author yuyongli
 * @since 2022-10-25 15:46:19
 */
@RestController
@RequestMapping("tMhtRecord")
public class TMhtRecordController {
    /**
     * 服务对象
     */
    @Autowired
    private TMhtRecordService tMhtRecordService;


    /**
     * 查询所有的做题记录
     * @return
     */
    @GetMapping
    public LayData getData(MyPage myPage, TMhtRecord tMhtRecord){
        return new LayData(tMhtRecordService.getAll(myPage,tMhtRecord));
    }
    @GetMapping("{id}")
    public LayData getDetailData(@PathVariable Integer id, MyPage myPage){
        return new LayData(tMhtRecordService.getDetailMsg(myPage,id));
    }



    @GetMapping("checkrecord")
    public LayData checkUser(TMhtRecord record){
        return new LayData(tMhtRecordService.checkrecord(record));
    }

     @PostMapping("addrecord")
    public LayData addrecord(TMhtRecord record){
         System.out.println(record+"--------------------------");
         return new LayData(tMhtRecordService.insertRecord(record));
    }

    @GetMapping("tj")
    public LayData getTongji(){

        return new LayData(tMhtRecordService.getTjData());
    }
    @GetMapping("tj2")
    public LayData getTongji2(MyPage myPage, TMhtMessage tMhtMessage){
        return new LayData(tMhtRecordService.getTjData2(myPage,tMhtMessage));
    }

}

